<head>
    <meta charset="UTF-8">
<title>算法训练 后缀数组——最长重复子串</title>
<link rel="stylesheet" href="../css/main.css">
</head>
 <p>【问题描述】<br />
给定一个长度为n的数串，求至少出现k 次的最长重复子串的长度，这k 个子串可以重叠。保证有子串出现至少k次。<br />
【输入格式】<br />
第一行：两个整数n, k;</p>
<p>第二行：2到n + 1行：n个整数，这n个整数组成了一个数串。<br />
【输出格式】<br />
一个整数，表示最长重复子串的长度。<br />
【样例输入】</p>
<pre style="font-family: 'Courier New', Courier, monospace; font-size: medium;" class="sio">
8 2</pre>
<p>&nbsp;</p>
<pre style="font-family: 'Courier New', Courier, monospace; font-size: medium;" class="sio">
1
</pre>
<p>&nbsp;</p>
<pre style="font-family: 'Courier New', Courier, monospace; font-size: medium;" class="sio">
2<br style="font-family: Arial, Verdana, sans-serif; font-size: 12px; white-space: normal;" />

</pre>
<pre style="font-family: 'Courier New', Courier, monospace; font-size: medium;" class="sio">
3<br style="font-family: Arial, Verdana, sans-serif; font-size: 12px; white-space: normal;" />

</pre>
<pre style="font-family: 'Courier New', Courier, monospace; font-size: medium;" class="sio">
2<br style="font-family: Arial, Verdana, sans-serif; font-size: 12px; white-space: normal;" />

</pre>
<pre style="font-family: 'Courier New', Courier, monospace; font-size: medium;" class="sio">
3<br style="font-family: Arial, Verdana, sans-serif; font-size: 12px; white-space: normal;" />

</pre>
<pre style="font-family: 'Courier New', Courier, monospace; font-size: medium;" class="sio">
2<br style="font-family: Arial, Verdana, sans-serif; font-size: 12px; white-space: normal;" />

</pre>
<pre style="font-family: 'Courier New', Courier, monospace; font-size: medium;" class="sio">
3<br style="font-family: Arial, Verdana, sans-serif; font-size: 12px; white-space: normal;" />

</pre>
<pre style="font-family: 'Courier New', Courier, monospace; font-size: medium;" class="sio">
1</pre>
<p>【样例输出】</p>
<pre style="font-family: 'Courier New', Courier, monospace; font-size: medium;" class="sio">
4</pre>
<p>【数据规模和约定】<br />
<span style="font-family: 'Times New Roman', Times, serif; font-size: 16px;">0&nbsp;</span><span style="font-family: 'Times New Roman', Times, serif; font-size: 16px;">&le; n </span><span style="font-family: 'Times New Roman', Times, serif; font-size: 16px;">&le; 20000,&nbsp;</span><span style="font-family: 'Times New Roman', Times, serif; font-size: 16px;">2 &le;&nbsp;</span><i style="font-family: 'Times New Roman', Times, serif; font-size: 16px;">k</i><span style="font-family: 'Times New Roman', Times, serif; font-size: 16px;">&nbsp;&le;&nbsp;</span><i style="font-family: 'Times New Roman', Times, serif; font-size: 16px;">n，0</i><span style="font-family: 'Times New Roman', Times, serif; font-size: 16px;">&le;</span><span style="font-family: 'Times New Roman', Times, serif; font-size: 16px;">&nbsp;</span><i style="font-family: 'Times New Roman', Times, serif; font-size: 16px;">数串中的整数</i><span style="font-family: 'Times New Roman', Times, serif; font-size: 16px;">&le;</span><span style="font-family: 'Times New Roman', Times, serif; font-size: 16px;">&nbsp;1000000</span></p>